package cn.abdl.springsecurity.config;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.context.ServletContextAware;

import javax.servlet.ServletContext;

@ControllerAdvice
public class GlobalControllerAdvice implements ServletContextAware {
    private Logger logger = LoggerFactory.getLogger(GlobalControllerAdvice.class);
    private ServletContext servletContext;

    @Override
    public void setServletContext(ServletContext servletContext) {
        this.servletContext = servletContext;
        this.servletContext.setAttribute("base", this.servletContext.getContextPath());
    }
}
